#ifndef WOLF_ACTOR_TEST_HPP
#define WOLF_ACTOR_TEST_HPP

#include "StdTest.hpp"
#include "actor.hpp"

namespace wolf {
class ActorTest: public StdTest {
public:

	class MyEventHandler: public Manager {
	public:
		Sprite sprite;
		Actor actor1;
		Actor actor2;
		Actor actor3;

		MyEventHandler() :
				sprite("resource/spritetest.png", 4, 1), actor1(sprite, 16, 16,
						-10), actor2(sprite, 160, 0, 10), actor3(sprite, 0, 160,
						-10) {
		}

		void onFrame(Engine &engine) {
			actor1.doFrame();
			actor2.doFrame();
			actor3.doFrame();
			if (actor1.collides(actor2)) {
//                    actor2.goLastPosition();
				actor2.setVelX(0);
				actor2.setVelY(0);
			}
			if (actor1.collides(actor3)) {
//                    actor3.goLastPosition();
				actor3.setVelX(0);
				actor3.setVelY(0);
			}
		}

		void onDraw(Engine &engine, SDL_Surface*dst) {
		}
	};

	ActorTest() :
			StdTest("Actors") {
	}

	bool run(Engine &engine) {
		MyEventHandler handler;
//            handler.actor1.pixelCollision(true);
//            handler.actor3.pixelCollision(true);
		handler.actor2.setVelX(-4);
		handler.actor3.setVelY(-4);
//		engine.addLayer(handler.actor1);
//		engine.addLayer(handler.actor2);
//		engine.addLayer(handler.actor3);
		engine.addManager(handler);

		while (engine.isRunning()) {
			engine.doFrame();
		}

		return true;
	}
};
}

#endif // WOLF_ACTOR_TEST_HPP
